package com.fjec.common.shiro;

import com.fjec.common.util.SequenceIdGenerator;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionIdGenerator;

import java.io.Serializable;

public class SnowFlakeSessionIdGenerator implements SessionIdGenerator {

    private SequenceIdGenerator idGenerator;

    public SnowFlakeSessionIdGenerator(SequenceIdGenerator idGenerator) {
        this.idGenerator = idGenerator;
    }

    @Override
    public Serializable generateId(Session session) {
        return idGenerator.nextId();
    }
}
